$(()=>{
  //get dom elem
  let $width = $('#width'),
      $height = $('#height'),
      //$btnCal = $('#calc'),
      $form = $('#main'),
      $perimeter = $('#perimeter'),
      $widthValidate = $('#width-validate'),
      $heightValidate = $('#height-validate'),
      $area = $('#area');

   /*calc button click*/
  //$btnCal.click(()=>{
  $form.submit((e)=>{
    e.preventDefault();
    //get value
    let w = Number($width.val()),
        h = Number($height.val());

    var p = Number((w+h)*2),
        a = Number(w*h);
    //output
    $perimeter.val(p);
    $area.val(a);
  });
});

